import Vue from "vue";
import Vuex from 'vuex';

Vue.use(Vuex);

let store = new Vuex.Store({
  state: {
    bgImage: 'linear-gradient(120deg, #6190e8 30%, #a7bfe8 100%)', // 当前背景
    currentTheme: 'sunny', // 当前主题
    currentTime: 'morning', // 当前时间段
    changeMode: 1 , // 天气背景变化模式 1 - 根据时间自动变化； 0 - 手动选择背景
  },
  getters: {
    bgImage: state => {
      return state.bgImage;
    },
    currentTheme: state => {
      return state.currentTheme;
    },
    currentTime: state => {
      return state.currentTime;
    },
    changeMode: state => {
      return state.changeMode;
    }
  },
  mutations: {
    setBgImage: (state, value) => {
      state.bgImage = value;
    },
    setCurrentTheme: (state, value) => {
      state.currentTheme = value;
    },
    setCurrentTime: (state, value) => {
      state.currentTime = value;
    },
    setChangeMode: (state, value) => {
      state.changeMode = value;
    }
  }
});

export default store;

